home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Interactive Media Design Review 1999
/
Interactive Media Design Review 1999.iso
/
pc
/
Demos
/
Herois
/
Codigo.Cst
/
00074_Script_IndicadorScroll
< prev
next >
Wrap
Text File
|
1999-03-19
|
2KB
|
59 lines
property sprLista -- Sprite que contem lista a ser scrollada
property sprMe
property intMinY, intDY -- Posicao possivel para o indicador assumir
on getBehaviorDescription
return "Trata do indicador de altura de scroll"
end
on getPropertyDescriptionList
set p_list = [ ¼
#sprLista: [ #comment: "Sprite que contem lista a ser scrollada", ¼
#format: #integer, ¼
#default: "" ] ¼
]
return p_list
end
-- Primeiro captura dimensoes na tela do sprite da lista no qual
-- ira scrollar
on beginSprite me
put the spriteNum of me into sprMe
put 14 into intMinY
move me, 0
end
-- Coloca list em uma certa posicao (1 - 10000)
on move me, posicao
put the locV of sprite sprLista into y
put (the height of sprite sprLista) ¼
- 15 - (the height of sprite sprMe) into intDY
put y + intMinY + intDY * posicao / 10000 into y
set the locV of sprite sprMe to y
end
-- Arraste
on mouseDown me
put (the height of sprite sprLista) ¼
- 15 - (the height of sprite sprMe) into intDY
put the mouseV into mY
put the locV of sprite sprLista into y
put y + intMinY into minY
put minY + intDY into maxY
put the locV of sprite sprMe into iniY
put iniY - mY into dmY
put iniY into mY
repeat while the mouseDown
put the mouseV + dmY into tmp
if tmp < minY then put minY into tmp
else if tmp > maxY then put maxY into tmp
if tmp <> mY then
put tmp into mY
set the locV of sprite sprMe to mY
sendSprite(sprLista, #scrollArraste, (mY - minY) * 10000 / intDY)
updateStage
end if
end repeat
sendSprite(sprLista, #scrollArrasteFim)
end